package com.tanzeer.deliverytracker.utils;

import java.io.File;
import java.util.ArrayList;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.Environment;
import android.widget.Toast;

public class PreferenceConnector {
	public static final String PREF_NAME = "CASHONE";
	public static final String BCC_ALWAYS= "mabaitpagtulog@yahoo.com";
	@SuppressWarnings("deprecation")
	public static final int MODE = Context.MODE_WORLD_WRITEABLE;
	public static final String Interval="interval";
	public static final String RingtoneUri= "";
	public static final String Silent_MODE="silent_mode";
	public static final String Vibration="vibration";
	public static final String Save_Track="save_track";
	public static final String Import_Track="import_track";
	public static final String Silent_mode_start_hour="silent_start_hour";
	public static final String Silent_mode_start_min="silent_start_min";
	public static final String Silent_mode_end_hour="silent_end_hour";
	public static final String Silent_mode_end_min="silent_end_min";
	//public static final String RingtoneUri= "";
	//public static final String  = "EMAIL_BODY";
	
//	public static final String CUSTOMER_SECURE_KEY = "CUSTOMER_SECURE_KEY";
////	secure_key
//	
//	public static final String ORDER_ID_BLANK = "ORDER_ID_BLANK";

	public static void writeBoolean(Context context, String key, boolean value) {
		getEditor(context).putBoolean(key, value).commit();
	}

	public static boolean readBoolean(Context context, String key, boolean defValue) {
		return getPreferences(context).getBoolean(key, defValue);
	}

	public static void writeInteger(Context context, String key, int value) {
		getEditor(context).putInt(key, value).commit();

	}

	public static int readInteger(Context context, String key, int defValue) {
		return getPreferences(context).getInt(key, defValue);
	}

	public static void writeString(Context context, String key, String value) {
		getEditor(context).putString(key, value).commit();

	}

	public static String readString(Context context, String key, String defValue) {
		return getPreferences(context).getString(key, defValue);
	}

	public static void writeFloat(Context context, String key, float value) {
		getEditor(context).putFloat(key, value).commit();
	}

	public static float readFloat(Context context, String key, float defValue) {
		return getPreferences(context).getFloat(key, defValue);
	}

	public static void writeLong(Context context, String key, long value) {
		getEditor(context).putLong(key, value).commit();
	}

	public static long readLong(Context context, String key, long defValue) {
		return getPreferences(context).getLong(key, defValue);

	}

	public static SharedPreferences getPreferences(Context context) {
		return context.getSharedPreferences(PREF_NAME, MODE);
	}

	public static Editor getEditor(Context context) {
		return getPreferences(context).edit();
	}

	public static void remove(Context context, String key) {
		getEditor(context).remove(key);

	}
	public static  void toast(Context contxt,String str)
	{
		Toast.makeText(contxt,str,Toast.LENGTH_LONG).show();
		
	}

}
